package com.fitns.user.mapper.baseConfig;

import static org.mybatis.dynamic.sql.SqlBuilder.*;

import com.fitns.user.model.baseConfig.TbCheckVehicleRoad;

import java.util.List;
import javax.annotation.Generated;

import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;
import org.mybatis.dynamic.sql.SqlBuilder;
import org.mybatis.dynamic.sql.delete.DeleteDSL;
import org.mybatis.dynamic.sql.delete.MyBatis3DeleteModelAdapter;
import org.mybatis.dynamic.sql.delete.render.DeleteStatementProvider;
import org.mybatis.dynamic.sql.insert.render.InsertStatementProvider;
import org.mybatis.dynamic.sql.render.RenderingStrategy;
import org.mybatis.dynamic.sql.select.MyBatis3SelectModelAdapter;
import org.mybatis.dynamic.sql.select.QueryExpressionDSL;
import org.mybatis.dynamic.sql.select.SelectDSL;
import org.mybatis.dynamic.sql.select.render.SelectStatementProvider;
import org.mybatis.dynamic.sql.update.MyBatis3UpdateModelAdapter;
import org.mybatis.dynamic.sql.update.UpdateDSL;
import org.mybatis.dynamic.sql.update.render.UpdateStatementProvider;
import org.mybatis.dynamic.sql.util.SqlProviderAdapter;

@Mapper
public interface TbCheckVehicleRoadMapper {
    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    @SelectProvider(type=SqlProviderAdapter.class, method="select")
    long count(SelectStatementProvider selectStatement);

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    @DeleteProvider(type=SqlProviderAdapter.class, method="delete")
    int delete(DeleteStatementProvider deleteStatement);

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    @InsertProvider(type=SqlProviderAdapter.class, method="insert")
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="record.id", before=false, resultType=Long.class)
    int insert(InsertStatementProvider<TbCheckVehicleRoad> insertStatement);

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    @SelectProvider(type=SqlProviderAdapter.class, method="select")
    @ResultMap("TbCheckVehicleRoadResult")
    TbCheckVehicleRoad selectOne(SelectStatementProvider selectStatement);

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    @SelectProvider(type=SqlProviderAdapter.class, method="select")
    @Results(id="TbCheckVehicleRoadResult", value = {
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="organ_id", property="organId", jdbcType=JdbcType.BIGINT),
        @Result(column="area_id", property="areaId", jdbcType=JdbcType.BIGINT),
        @Result(column="road_id", property="roadId", jdbcType=JdbcType.BIGINT),
        @Result(column="machine_score", property="machineScore", jdbcType=JdbcType.REAL),
        @Result(column="fix_tangs", property="fixTangs", jdbcType=JdbcType.INTEGER),
        @Result(column="real_tangs", property="realTangs", jdbcType=JdbcType.INTEGER),
        @Result(column="fix_mileage", property="fixMileage", jdbcType=JdbcType.REAL),
        @Result(column="real_mileage", property="realMileage", jdbcType=JdbcType.REAL),
        @Result(column="oil", property="oil", jdbcType=JdbcType.REAL),
        @Result(column="speed", property="speed", jdbcType=JdbcType.REAL),
        @Result(column="exception_times", property="exceptionTimes", jdbcType=JdbcType.INTEGER),
        @Result(column="and_score", property="andScore", jdbcType=JdbcType.REAL),
        @Result(column="sub_score", property="subScore", jdbcType=JdbcType.REAL),
        @Result(column="input_time", property="inputTime", jdbcType=JdbcType.TIMESTAMP)
    })
    List<TbCheckVehicleRoad> selectMany(SelectStatementProvider selectStatement);

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    @UpdateProvider(type=SqlProviderAdapter.class, method="update")
    int update(UpdateStatementProvider updateStatement);

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default QueryExpressionDSL<MyBatis3SelectModelAdapter<Long>> countByExample() {
        return SelectDSL.selectWithMapper(this::count, SqlBuilder.count())
                .from(TbCheckVehicleRoadDynamicSqlSupport.tbCheckVehicleRoad);
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default DeleteDSL<MyBatis3DeleteModelAdapter<Integer>> deleteByExample() {
        return DeleteDSL.deleteFromWithMapper(this::delete, TbCheckVehicleRoadDynamicSqlSupport.tbCheckVehicleRoad);
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default int deleteByPrimaryKey(Long id_) {
        return DeleteDSL.deleteFromWithMapper(this::delete, TbCheckVehicleRoadDynamicSqlSupport.tbCheckVehicleRoad)
                .where(TbCheckVehicleRoadDynamicSqlSupport.id, isEqualTo(id_))
                .build()
                .execute();
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default int insert(TbCheckVehicleRoad record) {
        return insert(SqlBuilder.insert(record)
                .into(TbCheckVehicleRoadDynamicSqlSupport.tbCheckVehicleRoad)
                .map(TbCheckVehicleRoadDynamicSqlSupport.organId).toProperty("organId")
                .map(TbCheckVehicleRoadDynamicSqlSupport.areaId).toProperty("areaId")
                .map(TbCheckVehicleRoadDynamicSqlSupport.roadId).toProperty("roadId")
                .map(TbCheckVehicleRoadDynamicSqlSupport.machineScore).toProperty("machineScore")
                .map(TbCheckVehicleRoadDynamicSqlSupport.fixTangs).toProperty("fixTangs")
                .map(TbCheckVehicleRoadDynamicSqlSupport.realTangs).toProperty("realTangs")
                .map(TbCheckVehicleRoadDynamicSqlSupport.fixMileage).toProperty("fixMileage")
                .map(TbCheckVehicleRoadDynamicSqlSupport.realMileage).toProperty("realMileage")
                .map(TbCheckVehicleRoadDynamicSqlSupport.oil).toProperty("oil")
                .map(TbCheckVehicleRoadDynamicSqlSupport.speed).toProperty("speed")
                .map(TbCheckVehicleRoadDynamicSqlSupport.exceptionTimes).toProperty("exceptionTimes")
                .map(TbCheckVehicleRoadDynamicSqlSupport.andScore).toProperty("andScore")
                .map(TbCheckVehicleRoadDynamicSqlSupport.subScore).toProperty("subScore")
                .map(TbCheckVehicleRoadDynamicSqlSupport.inputTime).toProperty("inputTime")
                .build()
                .render(RenderingStrategy.MYBATIS3));
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default int insertSelective(TbCheckVehicleRoad record) {
        return insert(SqlBuilder.insert(record)
                .into(TbCheckVehicleRoadDynamicSqlSupport.tbCheckVehicleRoad)
                .map(TbCheckVehicleRoadDynamicSqlSupport.organId).toPropertyWhenPresent("organId", record::getOrganId)
                .map(TbCheckVehicleRoadDynamicSqlSupport.areaId).toPropertyWhenPresent("areaId", record::getAreaId)
                .map(TbCheckVehicleRoadDynamicSqlSupport.roadId).toPropertyWhenPresent("roadId", record::getRoadId)
                .map(TbCheckVehicleRoadDynamicSqlSupport.machineScore).toPropertyWhenPresent("machineScore", record::getMachineScore)
                .map(TbCheckVehicleRoadDynamicSqlSupport.fixTangs).toPropertyWhenPresent("fixTangs", record::getFixTangs)
                .map(TbCheckVehicleRoadDynamicSqlSupport.realTangs).toPropertyWhenPresent("realTangs", record::getRealTangs)
                .map(TbCheckVehicleRoadDynamicSqlSupport.fixMileage).toPropertyWhenPresent("fixMileage", record::getFixMileage)
                .map(TbCheckVehicleRoadDynamicSqlSupport.realMileage).toPropertyWhenPresent("realMileage", record::getRealMileage)
                .map(TbCheckVehicleRoadDynamicSqlSupport.oil).toPropertyWhenPresent("oil", record::getOil)
                .map(TbCheckVehicleRoadDynamicSqlSupport.speed).toPropertyWhenPresent("speed", record::getSpeed)
                .map(TbCheckVehicleRoadDynamicSqlSupport.exceptionTimes).toPropertyWhenPresent("exceptionTimes", record::getExceptionTimes)
                .map(TbCheckVehicleRoadDynamicSqlSupport.andScore).toPropertyWhenPresent("andScore", record::getAndScore)
                .map(TbCheckVehicleRoadDynamicSqlSupport.subScore).toPropertyWhenPresent("subScore", record::getSubScore)
                .map(TbCheckVehicleRoadDynamicSqlSupport.inputTime).toPropertyWhenPresent("inputTime", record::getInputTime)
                .build()
                .render(RenderingStrategy.MYBATIS3));
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default QueryExpressionDSL<MyBatis3SelectModelAdapter<List<TbCheckVehicleRoad>>> selectByExample() {
        return SelectDSL.selectWithMapper(this::selectMany, TbCheckVehicleRoadDynamicSqlSupport.id, TbCheckVehicleRoadDynamicSqlSupport.organId, TbCheckVehicleRoadDynamicSqlSupport.areaId, TbCheckVehicleRoadDynamicSqlSupport.roadId, TbCheckVehicleRoadDynamicSqlSupport.machineScore, TbCheckVehicleRoadDynamicSqlSupport.fixTangs, TbCheckVehicleRoadDynamicSqlSupport.realTangs, TbCheckVehicleRoadDynamicSqlSupport.fixMileage, TbCheckVehicleRoadDynamicSqlSupport.realMileage, TbCheckVehicleRoadDynamicSqlSupport.oil, TbCheckVehicleRoadDynamicSqlSupport.speed, TbCheckVehicleRoadDynamicSqlSupport.exceptionTimes, TbCheckVehicleRoadDynamicSqlSupport.andScore, TbCheckVehicleRoadDynamicSqlSupport.subScore, TbCheckVehicleRoadDynamicSqlSupport.inputTime)
                .from(TbCheckVehicleRoadDynamicSqlSupport.tbCheckVehicleRoad);
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default QueryExpressionDSL<MyBatis3SelectModelAdapter<List<TbCheckVehicleRoad>>> selectDistinctByExample() {
        return SelectDSL.selectDistinctWithMapper(this::selectMany, TbCheckVehicleRoadDynamicSqlSupport.id, TbCheckVehicleRoadDynamicSqlSupport.organId, TbCheckVehicleRoadDynamicSqlSupport.areaId, TbCheckVehicleRoadDynamicSqlSupport.roadId, TbCheckVehicleRoadDynamicSqlSupport.machineScore, TbCheckVehicleRoadDynamicSqlSupport.fixTangs, TbCheckVehicleRoadDynamicSqlSupport.realTangs, TbCheckVehicleRoadDynamicSqlSupport.fixMileage, TbCheckVehicleRoadDynamicSqlSupport.realMileage, TbCheckVehicleRoadDynamicSqlSupport.oil, TbCheckVehicleRoadDynamicSqlSupport.speed, TbCheckVehicleRoadDynamicSqlSupport.exceptionTimes, TbCheckVehicleRoadDynamicSqlSupport.andScore, TbCheckVehicleRoadDynamicSqlSupport.subScore, TbCheckVehicleRoadDynamicSqlSupport.inputTime)
                .from(TbCheckVehicleRoadDynamicSqlSupport.tbCheckVehicleRoad);
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default TbCheckVehicleRoad selectByPrimaryKey(Long id_) {
        return SelectDSL.selectWithMapper(this::selectOne, TbCheckVehicleRoadDynamicSqlSupport.id, TbCheckVehicleRoadDynamicSqlSupport.organId, TbCheckVehicleRoadDynamicSqlSupport.areaId, TbCheckVehicleRoadDynamicSqlSupport.roadId, TbCheckVehicleRoadDynamicSqlSupport.machineScore, TbCheckVehicleRoadDynamicSqlSupport.fixTangs, TbCheckVehicleRoadDynamicSqlSupport.realTangs, TbCheckVehicleRoadDynamicSqlSupport.fixMileage, TbCheckVehicleRoadDynamicSqlSupport.realMileage, TbCheckVehicleRoadDynamicSqlSupport.oil, TbCheckVehicleRoadDynamicSqlSupport.speed, TbCheckVehicleRoadDynamicSqlSupport.exceptionTimes, TbCheckVehicleRoadDynamicSqlSupport.andScore, TbCheckVehicleRoadDynamicSqlSupport.subScore, TbCheckVehicleRoadDynamicSqlSupport.inputTime)
                .from(TbCheckVehicleRoadDynamicSqlSupport.tbCheckVehicleRoad)
                .where(TbCheckVehicleRoadDynamicSqlSupport.id, isEqualTo(id_))
                .build()
                .execute();
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default UpdateDSL<MyBatis3UpdateModelAdapter<Integer>> updateByExample(TbCheckVehicleRoad record) {
        return UpdateDSL.updateWithMapper(this::update, TbCheckVehicleRoadDynamicSqlSupport.tbCheckVehicleRoad)
                .set(TbCheckVehicleRoadDynamicSqlSupport.organId).equalTo(record::getOrganId)
                .set(TbCheckVehicleRoadDynamicSqlSupport.areaId).equalTo(record::getAreaId)
                .set(TbCheckVehicleRoadDynamicSqlSupport.roadId).equalTo(record::getRoadId)
                .set(TbCheckVehicleRoadDynamicSqlSupport.machineScore).equalTo(record::getMachineScore)
                .set(TbCheckVehicleRoadDynamicSqlSupport.fixTangs).equalTo(record::getFixTangs)
                .set(TbCheckVehicleRoadDynamicSqlSupport.realTangs).equalTo(record::getRealTangs)
                .set(TbCheckVehicleRoadDynamicSqlSupport.fixMileage).equalTo(record::getFixMileage)
                .set(TbCheckVehicleRoadDynamicSqlSupport.realMileage).equalTo(record::getRealMileage)
                .set(TbCheckVehicleRoadDynamicSqlSupport.oil).equalTo(record::getOil)
                .set(TbCheckVehicleRoadDynamicSqlSupport.speed).equalTo(record::getSpeed)
                .set(TbCheckVehicleRoadDynamicSqlSupport.exceptionTimes).equalTo(record::getExceptionTimes)
                .set(TbCheckVehicleRoadDynamicSqlSupport.andScore).equalTo(record::getAndScore)
                .set(TbCheckVehicleRoadDynamicSqlSupport.subScore).equalTo(record::getSubScore)
                .set(TbCheckVehicleRoadDynamicSqlSupport.inputTime).equalTo(record::getInputTime);
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default UpdateDSL<MyBatis3UpdateModelAdapter<Integer>> updateByExampleSelective(TbCheckVehicleRoad record) {
        return UpdateDSL.updateWithMapper(this::update, TbCheckVehicleRoadDynamicSqlSupport.tbCheckVehicleRoad)
                .set(TbCheckVehicleRoadDynamicSqlSupport.organId).equalToWhenPresent(record::getOrganId)
                .set(TbCheckVehicleRoadDynamicSqlSupport.areaId).equalToWhenPresent(record::getAreaId)
                .set(TbCheckVehicleRoadDynamicSqlSupport.roadId).equalToWhenPresent(record::getRoadId)
                .set(TbCheckVehicleRoadDynamicSqlSupport.machineScore).equalToWhenPresent(record::getMachineScore)
                .set(TbCheckVehicleRoadDynamicSqlSupport.fixTangs).equalToWhenPresent(record::getFixTangs)
                .set(TbCheckVehicleRoadDynamicSqlSupport.realTangs).equalToWhenPresent(record::getRealTangs)
                .set(TbCheckVehicleRoadDynamicSqlSupport.fixMileage).equalToWhenPresent(record::getFixMileage)
                .set(TbCheckVehicleRoadDynamicSqlSupport.realMileage).equalToWhenPresent(record::getRealMileage)
                .set(TbCheckVehicleRoadDynamicSqlSupport.oil).equalToWhenPresent(record::getOil)
                .set(TbCheckVehicleRoadDynamicSqlSupport.speed).equalToWhenPresent(record::getSpeed)
                .set(TbCheckVehicleRoadDynamicSqlSupport.exceptionTimes).equalToWhenPresent(record::getExceptionTimes)
                .set(TbCheckVehicleRoadDynamicSqlSupport.andScore).equalToWhenPresent(record::getAndScore)
                .set(TbCheckVehicleRoadDynamicSqlSupport.subScore).equalToWhenPresent(record::getSubScore)
                .set(TbCheckVehicleRoadDynamicSqlSupport.inputTime).equalToWhenPresent(record::getInputTime);
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default int updateByPrimaryKey(TbCheckVehicleRoad record) {
        return UpdateDSL.updateWithMapper(this::update, TbCheckVehicleRoadDynamicSqlSupport.tbCheckVehicleRoad)
                .set(TbCheckVehicleRoadDynamicSqlSupport.organId).equalTo(record::getOrganId)
                .set(TbCheckVehicleRoadDynamicSqlSupport.areaId).equalTo(record::getAreaId)
                .set(TbCheckVehicleRoadDynamicSqlSupport.roadId).equalTo(record::getRoadId)
                .set(TbCheckVehicleRoadDynamicSqlSupport.machineScore).equalTo(record::getMachineScore)
                .set(TbCheckVehicleRoadDynamicSqlSupport.fixTangs).equalTo(record::getFixTangs)
                .set(TbCheckVehicleRoadDynamicSqlSupport.realTangs).equalTo(record::getRealTangs)
                .set(TbCheckVehicleRoadDynamicSqlSupport.fixMileage).equalTo(record::getFixMileage)
                .set(TbCheckVehicleRoadDynamicSqlSupport.realMileage).equalTo(record::getRealMileage)
                .set(TbCheckVehicleRoadDynamicSqlSupport.oil).equalTo(record::getOil)
                .set(TbCheckVehicleRoadDynamicSqlSupport.speed).equalTo(record::getSpeed)
                .set(TbCheckVehicleRoadDynamicSqlSupport.exceptionTimes).equalTo(record::getExceptionTimes)
                .set(TbCheckVehicleRoadDynamicSqlSupport.andScore).equalTo(record::getAndScore)
                .set(TbCheckVehicleRoadDynamicSqlSupport.subScore).equalTo(record::getSubScore)
                .set(TbCheckVehicleRoadDynamicSqlSupport.inputTime).equalTo(record::getInputTime)
                .where(TbCheckVehicleRoadDynamicSqlSupport.id, isEqualTo(record::getId))
                .build()
                .execute();
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default int updateByPrimaryKeySelective(TbCheckVehicleRoad record) {
        return UpdateDSL.updateWithMapper(this::update, TbCheckVehicleRoadDynamicSqlSupport.tbCheckVehicleRoad)
                .set(TbCheckVehicleRoadDynamicSqlSupport.organId).equalToWhenPresent(record::getOrganId)
                .set(TbCheckVehicleRoadDynamicSqlSupport.areaId).equalToWhenPresent(record::getAreaId)
                .set(TbCheckVehicleRoadDynamicSqlSupport.roadId).equalToWhenPresent(record::getRoadId)
                .set(TbCheckVehicleRoadDynamicSqlSupport.machineScore).equalToWhenPresent(record::getMachineScore)
                .set(TbCheckVehicleRoadDynamicSqlSupport.fixTangs).equalToWhenPresent(record::getFixTangs)
                .set(TbCheckVehicleRoadDynamicSqlSupport.realTangs).equalToWhenPresent(record::getRealTangs)
                .set(TbCheckVehicleRoadDynamicSqlSupport.fixMileage).equalToWhenPresent(record::getFixMileage)
                .set(TbCheckVehicleRoadDynamicSqlSupport.realMileage).equalToWhenPresent(record::getRealMileage)
                .set(TbCheckVehicleRoadDynamicSqlSupport.oil).equalToWhenPresent(record::getOil)
                .set(TbCheckVehicleRoadDynamicSqlSupport.speed).equalToWhenPresent(record::getSpeed)
                .set(TbCheckVehicleRoadDynamicSqlSupport.exceptionTimes).equalToWhenPresent(record::getExceptionTimes)
                .set(TbCheckVehicleRoadDynamicSqlSupport.andScore).equalToWhenPresent(record::getAndScore)
                .set(TbCheckVehicleRoadDynamicSqlSupport.subScore).equalToWhenPresent(record::getSubScore)
                .set(TbCheckVehicleRoadDynamicSqlSupport.inputTime).equalToWhenPresent(record::getInputTime)
                .where(TbCheckVehicleRoadDynamicSqlSupport.id, isEqualTo(record::getId))
                .build()
                .execute();
    }
}